package com.heima.controller;


import com.heima.pojo.Channel;
import com.heima.pojo.dto.ChannelConfigDTO;
import com.heima.service.ChannelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/api/vm-service/channel")
public class ChannelController {

    @Autowired
    private ChannelService channelService;


    @GetMapping("/channelList/{innerCode}")
    public List<Channel> channels(@PathVariable Integer innerCode) {
        log.info("获取售货机货道详情：{}", innerCode);
        return channelService.channels(innerCode);
    }

    @PutMapping("/channelConfig")
    public Boolean channelConfig(@RequestBody ChannelConfigDTO dto){
        log.info("货道配置：{}",dto);
        return channelService.channelConfig(dto);
    }
}
